import Vue from 'vue' 
import 'amfe-flexible'
import App from '@/App.vue'
import router from '@/router/'
import store from '@/store/'
import '@/filters'
import '@/directives'
import '@/vant' // vant
import Skeleton from './components/Loader/index.js' // 骨架屏
import global from '@/global/'
import vconsole from 'vconsole'
import preview from 'vue-photo-preview'
// import vueg  from 'vueg'
import 'vue-photo-preview/dist/skin.css'


Vue.config.productionTip = false
Vue.prototype.$devicePixelRatio = window.devicePixelRatio
global()
Vue.use(Skeleton)

// let option = {
//   duration: 1,
//   enter: 'fadeInRight',
//   leave: 'fadeInLeft',
//   disableAtSameDepths: true,
//   shadow: false,
//   map: {

//   }
// }

// Vue.use(vueg, router, option)

let options = {
  fullscreenEl: false,
  closeEl:false,
  captionEl: false,
  zoomEl: false,
  closeElClasses: ['top-bar'],
};

Vue.use(preview,options)

if (process.env.NODE_ENV === 'development') {
  Vue.config.silent = false
  Vue.config.devtools = true
} else if (process.env.NODE_ENV === 'production') {
  Vue.config.silent = true
  Vue.config.devtools = false
  // new vconsole()
}

router.beforeEach((to, from, next) => {
  // if (document.querySelector('.router-view')) {
    // chrome
    // document.querySelector('.router-view').scrollTop = 0
    // firefox
    // document.querySelector('.router-view').scrollTop = 0
  // }
  // safari
  // window.pageYOffset = 0
  next()
})

if (process.env.VUE_APP_TOOL_VCONSOLE === 'true') new vconsole()

window.vue = new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
